package com.huaweicloud.apm.example;

import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;

public class Utils {

    public static ClientHttpRequestFactory simpleClientHttpRequestFactory() {
        SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
        factory.setReadTimeout(50000);
        factory.setConnectTimeout(50000);
        return factory;
    }

    public static RestTemplate restTemplate() {
        ClientHttpRequestFactory factory = simpleClientHttpRequestFactory();
        return new RestTemplate(factory);
    }

}
